package fx.mine.active.component.music.api;

import com.dtflys.forest.Forest;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.dbutils.DbUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;

@Log4j2
public class Test {
    public static void main(String[] args) throws SQLException {
        MusicApi client = Forest.client(MusicApi.class);
//        String s = client.queryCookies();
//        String s1 = client.queryHot(s);
        String s2 = client.playListDetail(7487435959L);
        log.info(s2);

//        String s = "hello";
//        DbUtils.loadDriver("org.sqlite.JDBC");
//        QueryRunner runner = new QueryRunner();

        Connection connection = DriverManager.getConnection("jdbc:sqlite:" + Test.class.getResource("/data/app.data").getPath());
        connection.setAutoCommit(true);
//        runner.insert(connection, " insert into appdata(key, ctime, value) values (?,?,?)", new ResultSetHandler<Object>() {
//            @Override
//            public Object handle(ResultSet resultSet) throws SQLException {
//
//                return null;
//            }
//        }, "key3", "2022-08-28 07:09:08", s);
//        Object query = runner.query(connection,"select id from appdata", new ResultSetHandler<Object>() {
//            @Override
//            public Object handle(ResultSet resultSet) throws SQLException {
//                return resultSet.getRowId(3);
//            }
//        });
//        System.out.println(query);
    }
}
